
    $(function(){
        //		地图
        $("#Map area").mouseover(function(e){
            e = e || window.event;
            // console.log(this)
            // $(this).css('border','1px solid red');
            var t = e.currentTarget , $t = $(t);
            var name = $t.attr('name');
            var $target = $('#map[name="'+name+'"]');
            console.log($(this).attr('coords'))
            var coords = $(this).attr('coords').split(',')
            var ret = { left: 0, top: 0, width:0, height:0 };
            var x = [], y = [];
            for (var len = coords.length, i = 0; i < len; i++) {
                if (i % 2 === 0) {
                    x.push(coords[i]);

                } else {
                    y.push(coords[i]);
                }
            }
            // console.log(x)
            ret.left = Math.min.apply(null, x);
            ret.top = Math.min.apply(null, y);
            ret.width = Math.max.apply(null, x) - ret.left;
            ret.height = Math.max.apply(null, y) - ret.top;

            console.log(ret)
            //139
            if(name === "小吕寨镇"){
                $('.mb-map img[name="小吕寨镇"]').css({
                    display:'block',
                    position: 'absolute',
                    left:59,
                    top:137 ,
                    // width:ret.width,
                    // height: ret.height
                }).siblings().css('display','none')
                $('.bigMap').css('display','block')
            }else if(name === "观寨乡"){
                $('.mb-map img[name="观寨乡"]').css({
                    display:'block',
                    position: 'absolute',
                    left:77,
                    top:37 ,
                    // width:ret.width,
                    // height: ret.height
                }).siblings().css('display','none')
                $('.bigMap').css('display','block')
            }else if(name === "官亭镇"){
                $('.mb-map img[name="官亭镇"]').css({
                    display:'block',
                    position: 'absolute',
                    left:135,
                    top:0 ,
                    // width:ret.width,
                    // height: ret.height
                }).siblings().css('display','none')
                $('.bigMap').css('display','block')
            }else if(name === "西郭城镇"){
                $('.mb-map img[name="西郭城镇"]').css({
                    display:'block',
                    position: 'absolute',
                    left:1,
                    top:154 ,
                    // width:ret.width,
                    // height: ret.height
                }).siblings().css('display','none')
                $('.bigMap').css('display','block')
            }else if(name === "苏家营乡"){
                $('.mb-map img[name="苏家营乡"]').css({
                    display:'block',
                    position: 'absolute',
                    left:177,
                    top:0 ,
                    // width:ret.width,
                    // height: ret.height
                }).siblings().css('display','none')
                $('.bigMap').css('display','block')
            }else if(name === "张王瞳乡"){
                $('.mb-map img[name="张王瞳乡"]').css({
                    display:'block',
                    position: 'absolute',
                    left:187,
                    top:158 ,
                    // width:ret.width,
                    // height: ret.height
                }).siblings().css('display','none')
                $('.bigMap').css('display','block')
            }
            else if(name === "巨鹿县"){
                $('.mb-map img[name="巨鹿县"]').css({
                    display:'block',
                    position: 'absolute',
                    left:107,
                    top:ret.top ,
                    // width:ret.width,
                    // height: ret.height
                }).siblings().css('display','none')
                $('.bigMap').css('display','block')
            }else if(name === "堤村乡"){
                $('.mb-map img[name="堤村乡"]').css({
                    display:'block',
                    position: 'absolute',
                    left:94,
                    top:ret.top
                    // width:ret.width,
                    // height: ret.height
                }).siblings().css('display','none');
                $('.bigMap').css('display','block');
            }else{
                $('.mb-map img[name="'+name+'"]').css({
                    display:'block',
                    position: 'absolute',
                    left:ret.left,
                    top:ret.top
                    // width:ret.width,
                    // height: ret.height
                }).siblings().css('display','none');
                $('.bigMap').css('display','block');
            }

        });
        $(".mb-map").each(function(i){
            $(this).mouseleave(function (e) {
                $(".mb-map").eq(i).children('img').css('display','none');
                // $('.mb-map img').css('display','none');
                $('.bigMap').css('display','block');
            });
        });

    })
